# Contributor: Carlo Landmeter <clandmeter@alpinelinux.org>
# Maintainer: Will Sinatra <wpsinatra@gmail.com>
pkgname=py3-discogs-client
_pyname=python3-discogs-client
pkgver=2.7
pkgrel=3
pkgdesc="Joalla Python Discogs API Client"
url="https://github.com/joalla/discogs_client"
arch="noarch"
license="BSD-2-Clause"
depends="py3-oauthlib py3-requests python3 py3-dateutil"
makedepends="py3-dateutil py3-setuptools py3-yaml py3-gpep517"
subpackages="$pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/p/python3-discogs-client/python3-discogs-client-$pkgver.tar.gz"
builddir="$srcdir/$_pyname-$pkgver"

replaces="py-discogs-client" # for backwards compatibility
provides="py-discogs-client=$pkgver-r$pkgrel" # for backwards compatibility

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	gpep517 install-wheel --destdir .testenv --prefix '' .dist/*.whl
	.testenv/bin/python3 -m unittest discover
}

package() {
	gpep517 install-wheel --destdir "$pkgdir" \
		.dist/*.whl
}

sha512sums="
7bb43429d6ceb3bbf892b6a65d4d93f0a9ec1bb3535b62169d7e1e4ff0e5032963b2ad5753e381745559efd21ed9e875bfbe3f5260e26f7df5f4a344bedded4a  python3-discogs-client-2.7.tar.gz
"
